package com.haiwen.boot.controller;


import com.haiwen.boot.mapper.UserMapper;
import com.haiwen.boot.service.LoginAndRegisterService;
import com.haiwen.boot.utils.JWTUtil;
import com.haiwen.boot.vo.ResultMap;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


@RestController
@Api(tags = "登录Api")
public class LoginController {
    @Autowired
    LoginAndRegisterService loginService;
    @PostMapping("/login")
    @ApiOperation(value = "登录操作")
    public Map<String,Object> login(@ApiParam("用户名")
                                    @RequestParam("username") String username,
                                    @ApiParam("密码")
                                    @RequestParam("password") String password) {
        return  loginService.Login(username, password);
    }
    @PostMapping("/SignOut")
    @ApiOperation(value = "登出操作")
    public ResultMap SignOut(@RequestParam String token){
       return loginService.SignOut(token);
    }
}
